Ext.define('App.projectorder.model.ProjectOrderViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.ProjectOrderViewModel',
    requires: ['App.projectorder.model.ProjectOrderModel'],
    data: {
        columns: [{
            header: 'ID',
            dataIndex: 'id',
            hidden: true
        }, {
            header: 'PO号',
            dataIndex: 'po',
            flex: 2,height:35
        }, {
            header: 'PO名称',
            dataIndex: 'name',
            flex: 5
        }, {
            header: '内部PO号',
            dataIndex: 'innerPo',
            flex: 2
        }, {
            header: '合同类型',
            dataIndex: 'contractType',
            flex: 2
        }, {
            header: '实施du',
            dataIndex: 'du',
            flex: 2
        }, {
            header: '在岸/离岸',
            dataIndex: 'onSite',
            flex: 1.3
        }, {
            header: '服务目录',
            dataIndex: 'serviceDirectory',
            flex: 2
        }, {
            header: '实施地域',
            dataIndex: 'effectArea',
            flex: 2
        }, {
            header: '交付部',
            dataIndex: 'deliveryDepartment',
            flex: 2
        }, {
            header: '交付部经理',
            dataIndex: 'deliveryManager',
            flex: 2
        },{
            header: '华为合作代表',
            dataIndex: 'huaweiRepresentative'
        }, {
            xtype: 'ymdcolumn',
            header: '立项时间',
            dataIndex: 'startDate',
            flex: 2
        }, {
            xtype: 'numbercolumn',
            header: '预计总工作量(人天)',
            dataIndex: 'planTotalQuantity',
            flex: 2
        }, {
            header: '创建人',
            dataIndex: 'creator',
            hidden: true
        }, {
            xtype: 'cdtcolumn',
            header: '创建时间',
            dataIndex: 'cdt',
            hidden: true
        }],
        simpleColumns: [{
            header: 'ID',
            dataIndex: 'id',
            hidden: true
        }, {
            header: 'PO号',
            dataIndex: 'po',height:35
        }, {
            header: 'PO名称',
            dataIndex: 'name'
        }, {
            header: '内部PO号',
            dataIndex: 'innerPo'
        }, {
            header: '合同类型',
            dataIndex: 'contractType'
        }, {
            header: '实施du',
            dataIndex: 'du'
        }, {
            header: '在岸/离岸',
            dataIndex: 'onSite'
        }, {
            header: '服务目录',
            dataIndex: 'serviceDirectory'
        }, {
            header: '实施地域',
            dataIndex: 'effectArea'
        }, {
            header: '交付部',
            dataIndex: 'deliveryDepartment'
        }, {
            header: '交付部经理',
            dataIndex: 'deliveryManager'
        }, {
            xtype: 'ymdcolumn',
            header: '立项时间',
            dataIndex: 'startDate'
        }, {
            xtype: 'numbercolumn',
            header: '预计总工作量(人天)',
            dataIndex: 'planTotalQuantity'
        }, {
            header: '创建人',
            dataIndex: 'creator',
            hidden: true
        }, {
            xtype: 'cdtcolumn',
            header: '创建时间',
            dataIndex: 'cdt',
            hidden: true
        }],
        search: {
            simpleSearch: true,
            advancedSearch: true,
            fields: [{
                name: "PO号",
                field: "po",
                vtype: 's',
                opt: 'like'
            }, {
                name: "PO名称",
                field: "name",
                vtype: 's',
                opt: 'like'
            }, {
                name: "内部PO号",
                field: "innerPo",
                vtype: 's',
                opt: 'like'
            }, {
                name: "合同类型",
                field: "contractType",
                vtype: 's',
                opt: 'like'
            }, {
                name: "实施du",
                field: "du",
                vtype: 's',
                opt: 'like'
            }, {
                name: "在岸/离岸",
                field: "onSite",
                vtype: 's',
                opt: 'like'
            }, {
                name: "交付部",
                field: "deliveryDepartment",
                vtype: 's',
                opt: 'like'
            }, {}]
        }
    },
    stores: {
        Query: {
            autoLoad: false,
            model: 'App.projectorder.model.ProjectOrderModel',
            pageSize: 25,
            remoteSort: true,
            sorters: [{
                property: 'cdt',
                direction: 'desc'
            }],
            proxy: {
                type: 'majax',
                url: 'projectorder/query_simple',
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total'
                }
            }
        },
        NotRefQuery: {
            autoLoad: false,
            model: 'App.projectorder.model.ProjectOrderModel',
            pageSize: 25,
            remoteSort: true,
            sorters: [{
                property: 'cdt',
                direction: 'desc'
            }],
            proxy: {
                type: 'majax',
                url: 'projectorder/query_not_ref_simple',
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total'
                }
            }
        }
    }
});